package org.todo.service;

import java.util.List;
import org.todo.controller.SearchCommand;
import org.todo.domain.Todo;

/**
 * Service interface that uses the TodoDao to manage todo objects
 * @author Matthias Braunhofer
 */
public interface TodoService {

    /**
     * Returns all todo items that belong to a certain category
     * @param categoryId
     * @return
     */
    public List<Todo> getTodos(int categoryId);

    /**
     * Returns all todo items for a certain user (including publicly available ones)
     * @param username
     * @return
     */
    public List<Todo> getTodos(String username);

    /**
     * Returns a todo object knowing only its id
     * @param todoId
     * @return
     */
    public Todo getTodo(int todoId);

    /**
     * Delegates the insertion of a certain todo item to the TodoDao
     * @param todo
     */
    public void addTodo(Todo todo);

    /**
     * Delegates the removal of a certain todo item to the TodoDao
     * @param todoId
     */
    public void deleteTodo(int todoId);

    /**
     * Returns all todo items for a certain user (including also publicly available ones)
     * that match the specified search criteria in SearchCommand
     * @param username
     * @param searchCommand
     * @return
     */
    public List<Todo> searchTodos(String username, SearchCommand searchCommand);
}
